﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace InnovTech.Util.VisualStudio
{
    public abstract class VSProject<TLanguage> where TLanguage : IVSLanguage
    {
        public VSProject(string fileFullPath)
        {
            Language = Activator.CreateInstance<TLanguage>();
            FileFullPath = fileFullPath;
        }

        string _fileFullPath;
        public string FileFullPath
        {
            get { return _fileFullPath; }
            set
            {
                if (string.IsNullOrEmpty(value))
                    throw new ArgumentNullException("The file path for a visual studio project can not be empty or null");
                if (File.Exists(value))
                    throw new ArgumentException("The given file does not exist");
                if (!Language.ProjectExtension.Equals(Path.GetExtension(value)))
                    throw new ArgumentException("The given file is not a visual studio project for the language: " + Language.Description);
                _fileFullPath = value;
                ProjectDir = Path.GetDirectoryName(value);
            }
        }
        public IVSLanguage Language { get; private set; }
        public string ProjectDir
        {
            get;
            private set;
        }


        public abstract void AddNeutralResxFile(string resxFile);
        public abstract void AddNonNeutralResxFile(string resxFile);
    }
}
